<?php/** * Created by PhpStorm. * User: hans233 * Date: 2019/8/13 * Time: 15:56 */namespace app\backstage\model;use think\Model;use think\Validate;class Nav extends Model{//    protected $name = 'lesson_type';    public function validate($data,$type='insert') {        $validate= new Validate([           'nav_name'=>'require',//            '__token__'  => 'require|token'        ]);        if (!$validate->check($data)) {            return ['code'=>101,'msg'=>$validate->getError()];        }//        if ($type == 'insert'){//            $row = $this->where('type_name',$data['type_name'])->find();//            return ['code'=>101,'msg'=>'尝试创建存在的分类'];//        }        return ['code' => 200];    }}